import type {PlasmoMessaging} from '@plasmohq/messaging'

const handler: PlasmoMessaging.MessageHandler = async (req, res) => {
    // console.log(req.body.message)
    // const message: string = "say hi from background"
    chrome.windows.getCurrent().then(window=>{
        chrome.tabs.captureVisibleTab(
            window?.id,
            {
                format:'jpeg',
                quality:100
            },dataUrl => {
                res.send({
                    message:dataUrl
                })
            }
        )
    })
}


export default handler
